package com.alibaba.cloud.apigateway.config;

import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.DefaultBlockRequestHandler;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * created by wuquan at 05/11/2021
 * ^_^ ^_^
 * 网关限流同意异常处理
 */
@Component
public class CustomDefaultExceptionHandler extends DefaultBlockRequestHandler {
    @Override
    public Mono<ServerResponse> handleRequest(ServerWebExchange exchange, Throwable ex) {
        //具体处理方法@see DefaultBlockRequestHandler
        return ServerResponse.status(1).build();
    }


}
